import axiosInstance from '@/tools/request'
import type { SysRole } from '@/api/sysRole/sysRole.d' // 这里时你将 sys_role.d.ts 存放的位置

//sysRoleAdd 系统角色添加
export const sysRoleAdd = (sysRole: SysRole) => {
  return axiosInstance({
    url: `/sysRole`,
    method: 'post',
    data: sysRole
  })
}

//sysRoleRemove 系统角色删除
export const sysRoleRemove = (sysRoleId: number) => {
  return axiosInstance({
    url: `/sysRole/${ sysRoleId }`,
    method: 'delete'
  })
}

//sysRoleModify 系统角色修改
export const sysRoleModify = (sysRole: SysRole) => {
  return axiosInstance({
    url: `/sysRole`,
    method: 'put',
    data: sysRole
  })
}

//sysRoleList 系统角色列表
export const sysRoleList = (sysRole:SysRole, params: any) => {
  return axiosInstance({
    url: '/sysRole/list',
    method: 'post',
    params: params,
    data: sysRole
  })
}

//sysRoleById 系统角色查询通过ID
export const sysRoleById = (sysRoleId: number) => {
  return axiosInstance({
    url: `/sysRole/${ sysRoleId }`,
    method: 'get'
  })
}

//sysRoleRemoveBatch 系统角色删除
export const sysRoleRemoveBatch = (ids: any[]) => {
  return axiosInstance({
    url: `/sysRole/batchDelete`,
    method: 'delete',
    params: {
      ids:ids
    }
  })
}

//sysRoleRemoveRefresh 系统角色刷新缓存
export const sysRoleRefresh= () => {
  return axiosInstance({
    url: `/sysRole/refresh`,
    method: 'get',
  })
}
